<%--                                                                       --%>
<%-- Copyright (c) 2005 BroadVision, Inc.  All rights reserved.            --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>


<%@ page import =  "java.util.HashMap,
                    org.apache.commons.beanutils.PropertyUtils,
                    org.apache.struts.validator.DynaValidatorForm"
%>

<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<script language="JavaScript">
         
  function doCancel(theForm) {
    var ok = confirm('<bean-el:message key="confirmCancel"  bundle="mt.messages"/>');
    if (ok && theForm != null) {
      var cancelAction ='<c:out value="${mtUserEditForm.map.cancelAction}"/>';
      theForm.action='<html-el:rewrite page="' + cancelAction + '" />';
      theForm.submit();
      return true;
    }
    return false;
  }

  function doUserDeleteAction(theForm) {
    if ( confirm('<bean-el:message key="mt.user.confirm.delete" bundle="mt.messages"/>') ){
      theForm.action = '<html-el:rewrite page="/mt/userDelete.do"/>';
      theForm.submit();
      return true;
    }
    return false;
  }
  function showDiv(divId) {
	  if(document.getElementById(divId)!=undefined&&document.getElementById(divId)!=null){
	  	   document.getElementById(divId).style.visibility = 'visible';
	  	   document.getElementById(divId).style.display = 'block';
	  }
  }//end func
  function hideDiv(divId) {
	  if(document.getElementById(divId)!=undefined&&document.getElementById(divId)!=null){
	    document.getElementById(divId).style.visibility = 'hidden';
	    document.getElementById(divId).style.display = 'none';
	  }  
  }//end func
   function showHideAccountDivs(){
   
  	var account_type=document.getElementById("ACCOUNT_TYPE");
  	if(account_type!=undefined) {
 	  	if(account_type.value==2){
	  		hideDiv('individual_account_data');
	  		showDiv('corporate_account_data');
	  	}
	  	else if(account_type.value==1){
	  		hideDiv('corporate_account_data');
	  		showDiv('individual_account_data');
	  	}
	  	else {
	  		hideDiv('corporate_account_data');
	  		showDiv('individual_account_data');
	  	}
  	}
  }		
  function doUserEditAction(theForm) {
      theForm.action = '<html-el:rewrite page="/mt/userEdit.do"/>';
      theForm.submit();
      return true;
  }
  
</script>

<%
  java.util.HashMap map = new java.util.HashMap();
  DynaValidatorForm mtUserEditForm = (DynaValidatorForm) request.getAttribute("mtUserEditForm");
  map.put("userId", (Long) PropertyUtils.getSimpleProperty(mtUserEditForm, "userId"));
  pageContext.setAttribute("pagetabParam", map, PageContext.PAGE_SCOPE);
%>

<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">

        <div class="pageTitle">
            <bean-el:message key="mt.user.view.page.title" bundle="mt.messages"/>:
            <c:out value="${mtUserView.map.formattedName}"/>
        </div> 

	<div class="errorMessage">
          <html-el:errors bundle="mt.messages" />
        </div>
        <%@include file="/mc/common/pagetab.jsp" %>

      <!-- end of PageTab -->			

<html-el:form action="/mt/userEdit.do">
<html-el:hidden property="ACCOUNT_TYPE"/>
<html-el:hidden name="mtUserEditForm" property="userId"/>

      <div class="pageSubtitle">
        <span class="left"><bean-el:message key="mt.user.userInfo" bundle="mt.messages"/></span>

        <span class="right">
          <c:if test="${mtUserView.map.canEdit}">
              <html-el:submit styleClass="inputButton" property="editBtn"  onclick="return doUserEditAction(this.form)">
                <bean-el:message key="button.edit" bundle="mt.messages"/>
              </html-el:submit>
          </c:if>
          <c:if test="${mtUserView.map.canDelete}">
              <html-el:submit styleClass="inputButton" property="deleteBtn" onclick="return doUserDeleteAction(this.form)">
                  <bean-el:message key="button.delete" bundle="mt.messages"/>
              </html-el:submit>
          </c:if>
        </span>
      </div>
</html-el:form>
	  
	  <c:set var="uDataList" scope="page" value="${mtUserView.map.userDataList}"/>
	  <c:set var="uTypeList" scope="page" value="${mtUserView.map.userTypeList}"/>
	  <c:set var="cStatusList" scope="page" value="${mtUserView.map.corporateStatusList}"/>
      <!--start main content area here-->
      <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="Process summary">
        <tr>
          <td valign="middle" width="16%" class="label">
              <bean-el:message key="mt.user.label.loginId" bundle="mt.messages"/>: 
          </td>
          <td valign="middle" width="24%" class="labelField">
             <c:out value="${mtUserView.map.userAlias}"/> &nbsp;
          </td>
          <c:if test="${mtUserView.map.showUserTemplate}">
            <td class="label" width="15%"><bean-el:message key="mt.user.label.userTemplate" bundle="mt.messages"/>:</td>
            <td class="labelField" width="35%">
              <c:out value="${mtUserView.map.userTemplateName}"/> &nbsp;
            </td>
          </c:if>
          <c:if test="${!mtUserView.map.showUserTemplate}">
            <td class="label" width="15%"></td>
            <td class="labelField" width="35%">
            </td>
          </c:if>
         </tr>
		    <tr>
           <td valign="middle" width="16%" class="label">
             <bean-el:message key="mt.user.label.active" bundle="mt.messages"/>:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:choose>
               <c:when test="${mtUserView.map.kmUserDeleted}">
                 <bean-el:message key="mt.user.label.yes" bundle="mt.messages"/>
               </c:when>
               <c:otherwise>
                 <bean-el:message key="mt.user.label.no" bundle="mt.messages"/>
               </c:otherwise>
             </c:choose>
           </td>

          <c:if test="${mtUserView.map.showUserTemplate}">

           <td valign="middle" width="16%" class="label">
             <bean-el:message key="mt.user.label.receivedEmailAlerts" bundle="mt.messages"/>:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:choose>
               <c:when test="${mtUserView.map.epEmailAlert}">
                 <bean-el:message key="mt.user.label.yes" bundle="mt.messages"/>
               </c:when>
               <c:otherwise>
                 <bean-el:message key="mt.user.label.no" bundle="mt.messages"/>
               </c:otherwise>
             </c:choose>
           </td>
          </c:if>
          <c:if test="${!mtUserView.map.showUserTemplate}">
            <td class="label" width="16%"></td>
            <td class="labelField" width="34%">
            </td>
          </c:if>
          <tr>
           <td valign="middle" width="16%" class="label">
             Civil Id:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.CIVIL_ID}"/> &nbsp;
           </td>
         <td valign="middle" width="16%" class="label">
              <bean-el:message key="mt.user.label.zipCode" bundle="mt.messages"/>:
            </td>
            <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.zipCode}"/> &nbsp;
            </td>
         </tr>
		 <tr>
           <td valign="middle" width="16%" class="label">
             <bean-el:message key="mt.user.label.email" bundle="mt.messages"/>:
           </td>
           <td valign="top" class="labelField">
             <c:out value="${mtUserView.map.email}"/> &nbsp;
           </td>
  		<td valign="middle" width="16%" class="label">
              Preferred Language:
           </td>
           <td valign="top" width="34%" class="labelField">
                  <c:forEach var="uT" items="${uDataList}">
               			<c:if test="${uT.name == 'Language'}">
                       <c:choose>
      				<c:when test="${uT.value == mtUserView.map.PREFERRED_LANGUAGE}">
      					<c:out value="${uT.key}"/>
      				</c:when>
    			   </c:choose>
                   </c:if>
                 </c:forEach> &nbsp;
           </td>
        </tr>   
           <tr>
           <td valign="middle" width="16%" class="label">
             Secret Question:
           </td>
           <td valign="top" width="34%" class="labelField">
  				 <c:out value="${mtUserView.map.SECRET_QUESTION_LDAP}"/> &nbsp;
           </td>
           <td valign="middle" width="16%" class="label">
              Answer:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.ANSWER}"/> &nbsp;
           </td>
         </tr>
	 <tr>
           <td valign="middle" width="16%" class="label">
             Account Type:
           </td>
           <td valign="top" width="34%" class="labelField">
            <c:choose>
               <c:when test="${mtUserView.map.ACCOUNT_TYPE==1}">
                 Individual
               </c:when>
               <c:otherwise>
                 Corporate
               </c:otherwise>
             </c:choose>
           </td>
           <td valign="middle" width="16%" class="label">
             User Details:
           </td>
           <td valign="top" width="34%" class="labelField">
               	 <c:forEach var="uT" items="${uTypeList}">
               	     <c:choose>
      				<c:when test="${uT.value == mtUserView.map.USER_DETAILS}">
      					<c:out value="${uT.key}"/>
      				</c:when>
    			   </c:choose>
                 </c:forEach> &nbsp;
           </td>
      </tr>

         </table>
         
         <div id="individual_account_data">	
         
          <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="Process summary">
         <c:if test="${!mtUserView.map.useFullName}" >
           <tr>
             <td valign="middle" width="16%" class="label">
               <bean-el:message key="mt.user.label.firstName" bundle="mt.messages"/>:
             </td>
             <td valign="top" width="34%" class="labelField">
               <c:out value="${mtUserView.map.firstName}"/> &nbsp;
             </td>
             <td valign="middle" width="16%" class="label">
               <bean-el:message key="mt.user.label.middleName" bundle="mt.messages"/>:
             </td>
             <td valign="top" width="34%" class="labelField">
               <c:out value="${mtUserView.map.middleName}"/> &nbsp;
             </td>
           </tr>
         </c:if>

         <tr> 
           <c:if test="${!mtUserView.map.useFullName}">
             <td valign="middle" width="16%" class="label">
                <bean-el:message key="mt.user.label.lastName" bundle="mt.messages"/>:
             </td>
             <td valign="top" width="34%" class="labelField">
               <c:out value="${mtUserView.map.lastName}"/> &nbsp;
             </td>
           </c:if>
           <c:if test="${mtUserView.map.useFullName}">
             <td valign="middle" width="16%" class="label">
                <bean-el:message key="mt.user.label.fullName" bundle="mt.messages"/>:
             </td>
             <td valign="top" width="34%" class="labelField">
               <c:out value="${mtUserView.map.fullName}"/> &nbsp;
             </td>
           </c:if>
            <td valign="middle" width="16%" class="label">
              <bean-el:message key="mt.user.label.mailStop" bundle="mt.messages"/>:
            </td>
            <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.mailStop}"/> &nbsp;
            </td>
         </tr>
 		<tr>
           <td valign="middle" width="16%" class="label">
              Name (Other):
           </td>
           <td valign="top" colspan="3" class="labelField">
             <c:out value="${mtUserView.map.NAME}"/> &nbsp;
           </td>
         </tr>
		 <tr>
           <td valign="middle" width="16%" class="label">
             Arabic Name:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.ARABIC_NAME}"/> &nbsp;
           </td>
           <td valign="middle" width="16%" class="label">
              Nationality:
           </td>
           <td valign="top" width="34%" class="labelField">
              <c:forEach var="uT" items="${uDataList}">
               			<c:if test="${uT.name == 'Country'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserView.map.NATIONALITY}">
      					<c:out value="${uT.value}"/>
      				</c:when>
    			   </c:choose>
                   </c:if>
                 </c:forEach> &nbsp;
           </td>
         </tr>
          <tr>
           <td valign="middle" width="16%" class="label">
             Mobile Number:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.MOBILE_NO}"/> &nbsp;
           </td>
           <td valign="middle" width="16%" class="label">
              Activation Code:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.ACTIVATION_CODE}"/> &nbsp;
           </td>
         </tr>
		 
		 
  	 <tr>
           <td valign="middle" width="16%" class="label">
             Date of Birth (Date):
           </td>
           <td valign="top" width="34%" class="labelField">
               	<bean:write name="mtUserView" property="DOB" bundle="em"  formatKey="format.datetime.long"/>&nbsp;
           </td>
           <td valign="middle" width="16%" class="label">
              PO Box:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.POBOX}"/> &nbsp;
           </td>
         </tr>
		 
		 <tr>
           <td valign="middle" width="16%" class="label">
             Residential Area:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:forEach var="uT" items="${uDataList}">
               			<c:if test="${uT.name == 'Residential Area'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserView.map.RESIDENTIAL_AREA}">
      					<c:out value="${uT.value}"/>
      				</c:when>
    			   </c:choose>
                   </c:if>
                 </c:forEach> &nbsp;
           </td>
           <td valign="middle" width="16%" class="label">
              Residence Length:
           </td>
           <td valign="top" width="34%" class="labelField">
            	<c:forEach var="uT" items="${uDataList}">
               			<c:if test="${uT.name == 'Residential Length'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserView.map.RESIDENCE_LENGTH}">
      					<c:out value="${uT.value}"/>
      				</c:when>
    			   </c:choose>
                   </c:if>
                 </c:forEach> &nbsp;
           </td>
         </tr>
		 
		 <tr>
           <td valign="middle" width="16%" class="label">
             Hobbies:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:forEach var="uT" items="${uDataList}">
               			<c:if test="${uT.name == 'Hobbies'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserView.map.HOBBIES}">
      					<c:out value="${uT.value}"/>
      				</c:when>
    			   </c:choose>
                   </c:if>
                 </c:forEach> &nbsp;
           </td>
           <td valign="middle" width="16%" class="label">
              Magazines:
           </td>
           <td valign="top" width="34%" class="labelField">
              <c:forEach var="uT" items="${uDataList}">
               			<c:if test="${uT.name == 'Magazines'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserView.map.MAGAZINES}">
      					<c:out value="${uT.value}"/>
      				</c:when>
    			   </c:choose>
                   </c:if>
                 </c:forEach> &nbsp;
           </td>
         </tr>
		
		 <tr>
           <td valign="middle" width="16%" class="label">
             Tv Programs:
           </td>
            <td valign="top" class="labelField" colspan="3">
  				 <c:forEach var="uT" items="${uDataList}">
               			<c:if test="${uT.name == 'TV Programs'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserView.map.TV_PROGRAMS}">
      					<c:out value="${uT.value}"/>
      				</c:when>
    			   </c:choose>
                   </c:if>
                 </c:forEach> &nbsp;
           </td>
           </tr>
	
           </table>
           </div>
             <div id="corporate_account_data">
            <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="Process summary">
		    <tr>
	       <td valign="middle" width="16%" class="label">
               Corporate User Status:
           </td>
           <td valign="top" colspan="3" class="labelField">
                  <c:forEach var="uT" items="${cStatusList}">
               	     <c:choose>
      				<c:when test="${uT.value == mtUserView.map.CORPORATE_USER_STATUS}">
      					<c:out value="${uT.key}"/>
      				</c:when>
    			   </c:choose>
                 </c:forEach> &nbsp;
           </td>
         </tr>
           <tr>
           <td valign="middle" width="16%" class="label">
               Application Date (Date):
           </td>
           <td valign="top" width="34%" class="labelField">
           <c:out value="${mtUserView.map.APPLICATION_DATE}"/> &nbsp;
           </td>
           <td valign="middle" width="16%" class="label">
              Approval Date (Date):
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.APPROVAL_DATE}"/> &nbsp;
           </td>
         </tr>
		
		 
		  <tr>
           <td valign="middle" width="16%" class="label">
             Organization Name:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.ORGANIZATION_NAME}"/> &nbsp;
           </td>
           <td valign="middle" width="16%" class="label">
              Organization Type:
           </td>
           <td valign="top" width="34%" class="labelField">
            		<c:forEach var="uT" items="${uDataList}">
               			<c:if test="${uT.name == 'Organization Type'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserView.map.ORGANIZATION_TYPE}">
      					<c:out value="${uT.value}"/>
      				</c:when>
    			   </c:choose>
                   </c:if>
                   </c:forEach> &nbsp;
           </td>
         </tr>
		 
		  <tr>
           <td valign="middle" width="16%" class="label">
             Business Objectives: 
           </td>
           <td valign="top" width="34%" class="labelField">
              <c:forEach var="uT" items="${uDataList}">
    
                   <c:if test="${uT.name == 'Business Objective'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserView.map.BUSINESS_OBJECTIVES}">
      					<c:out value="${uT.value}"/>
      				</c:when>
    			   </c:choose>
                   </c:if>
                   </c:forEach> &nbsp;
           </td>
           <td valign="middle" width="16%" class="label">
              Registration Id: 
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.REGISTRATION_ID}"/> &nbsp;
           </td>
         </tr>
		 
		   <tr>
           <td valign="middle" width="16%" class="label">
             Years of Estabilshment:
           </td>
           <td valign="top" width="34%" class="labelField">
           	  <c:forEach var="uT" items="${uDataList}">
              <c:if test="${uT.name == 'Years of Establishment'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserView.map.YEARS_OF_ESTABLISHMENT}">
      					<c:out value="${uT.value}"/>
      				</c:when>
    			   </c:choose>
                   </c:if>
                   </c:forEach> &nbsp;
           </td>
           <td valign="middle" width="16%" class="label">
              Employees Range:
           </td>
           <td valign="top" width="34%" class="labelField">
               <c:forEach var="uT" items="${uDataList}">
             <c:if test="${uT.name == 'Number of Employees'}">
                       <c:choose>
      				<c:when test="${uT.id == mtUserView.map.EMPLOYEES_RANGE}">
      					<c:out value="${uT.value}"/>
      				</c:when>
    			   </c:choose>
                   </c:if>
                   </c:forEach> &nbsp;
           </td>
         </tr>
		 
		  <tr>
           <td valign="middle" width="16%" class="label">
             GSM: 
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.GSM}"/> &nbsp;
           </td>
           <td valign="middle" width="16%" class="label">
              ETACS:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.ETACS}"/> &nbsp;
           </td>
         </tr>
		 
		 <tr>
           <td valign="middle" width="16%" class="label">
             PAGER: 
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.PAGER}"/> &nbsp;
           </td>
           <td valign="middle" width="16%" class="label">
              Contact Person:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.CONTACT_PERSON}"/> &nbsp;
           </td>
         </tr>
		 
		 <tr>
           <td valign="middle" width="16%" class="label">
             Contact Number:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.CONTACT_NUMBER}"/> &nbsp;
           </td>
           <td valign="middle" width="16%" class="label">
              Contact Title:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.CONTACT_TITLE}"/> &nbsp;
           </td>
         </tr>
         
          <tr>
           <td valign="middle" width="16%" class="label">
             Comments:
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.COMMENTS}"/> &nbsp;
           </td>
            <td valign="middle" width="16%" class="label">
             Contract Number
           </td>
           <td valign="top" width="34%" class="labelField">
             <c:out value="${mtUserView.map.CONTRACT_NUMBER}"/> &nbsp;
           </td>
         </tr>
		 <!--End 13 October 2008 -->
		
     
       </table>
       </div>
       <!--end main content area here-->
    </td>
  </tr>
</table>
<script>
showHideAccountDivs();
</script>
